'''
接口的四个参数

'''
import hashlib
import json


def getMD5(key):
    m5 = hashlib.md5()
    m5.update(key.encode('utf-8'))
    return m5.hexdigest()

def getSignature(url_path, param, appCode):
    i = url_path + json.dumps(param).replace(' ','') + getMD5(appCode)[0: 16]
    print(i)
    # i = url_path + param + getMD5(appCode)[0: 16]
    return getMD5(i)


url_path = '/v1/threads/list/bw'
appCode = 'PC42ce3bfa4980a9'
token = ''
signature = '' ## 这个要加密
# param = '''{\"fid\":\"5055\",\"showUnAnswer\":1,\"typeId\":5,\"lastItem\":\"\",\"position\":\"1\",\"rows\":10,\"orderType\":2}'''

param = {}
param['fid'] = '5055'
param['showUnAnswer'] = 1
param['typeId'] = 5
param['lastItem'] = ''
param['position'] = '1'
param['rows'] = 10
param['orderType'] = 2


print(getSignature(url_path, param, appCode))





